package com.hanyizhu.demostore.service.impl;

import com.hanyizhu.demostore.entity.Order;
import com.hanyizhu.demostore.entity.OrderItem;
import com.hanyizhu.demostore.mapper.OrderItemMapper;
import com.hanyizhu.demostore.mapper.OrderMapper;
import com.hanyizhu.demostore.service.IOrderItemService;
import com.hanyizhu.demostore.service.ex.OrderItemNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author lenovo
 */
@Service
public class OrderitemServiceImpl implements IOrderItemService {

    @Autowired
    private OrderMapper orderMapper;
    @Autowired
    private OrderItemMapper orderItemMapper;
    @Override
    public List<OrderItem> getByOid(Integer oid) {
        List<OrderItem> byOid = orderItemMapper.findByOid(oid);
        if (byOid == null){
            throw new OrderItemNotFoundException("订单项详细数据不存在");
        }
        return byOid;
    }
}
